/*
 * @Author: your name
 * @Date: 2024-04-03 20:13:33
 * @LastEditTime: 2024-04-03 20:16:48
 * @LastEditors: your name
 * @Description: In User Settings Edit
 * @FilePath: \undefinedc:\Users\ljg\.leetcode\383.赎金信.cpp
 */
/*
 * @lc app=leetcode.cn id=383 lang=cpp
 *
 * [383] 赎金信
 */

// @lc code=start
class Solution {
public:
    bool canConstruct(string ransomNote, string magazine) {
        int table[26] = {0};
        for(char mag:magazine){
            table[mag-'a']++;
        }
        for(char ran:ransomNote){
            table[ran-'a']--;
        }
        for(int tt: table){
            if(tt < 0){
                return false;
            }
        }
        return true;
    }
};
// @lc code=end

